import { CommonUtil } from 'src/app/common/utils/common.util'
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'

@Component({
    selector: 'cp-estate-comment-more',
    templateUrl: './estate-comment-more.component.html',
    styleUrls: ['./estate-comment-more.component.scss']
})
export class EstateCommentMoreComponent implements OnInit {

    public isDj: boolean = false;
    public imgview = {
        "show": false,
        "list": [],
        "index": 0
    }

    sliderConfig = {
        effect: 'slide',
        autoHeight: true,
        loop: true
    }

    @Input() item: any
    @Input() isPraise:boolean = true;
    @Output() praise = new EventEmitter<any>()

    constructor(private commonUtil: CommonUtil) { }

    ngOnInit() { }

    clickPraise(event) {
        event.stopPropagation();

        this.isDj = true;
        this.praise.emit(this.item.Id);
    }

    showImg(event,index, items) {

        event.stopPropagation();

        let _list = [];

        items.forEach(element => {
            let o = {};
            o['Photo'] = element;
            _list.push(o);
        });

        this.imgview = {
            "show": true,
            "list": _list,
            "index": index
        }

    }

    handleClose() {
        this.imgview.show = false;
    }
}
